﻿using AbpApplication.InPut;
using MathNet.Numerics.LinearAlgebra.Factorization;
using NewWms.Apiservice;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Services.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace Reconstruct_Desktop.ViewModels.DialogsModel
{
    public class Create_BintypeDialogModel : BindableBase, IDialogAware
    {

        private IBaseService_Client baseService;
        public DelegateCommand<string> Command { get; set; }
        private InPut_BaseService16_Client inPut_BaseServie16;
        public InPut_BaseService16_Client InPut_BaseServie16
        {
            get { return inPut_BaseServie16; }
            set { inPut_BaseServie16 = value; RaisePropertyChanged(); }
        }
        public Create_BintypeDialogModel()
        {
            Command = new DelegateCommand<string>(Method);
            baseService = new BaseService_Client();
            InPut_BaseServie16=new InPut_BaseService16_Client();
        }


        public async void Method(string obj)
        {
            switch (obj)
            {
                case "CloseDialog": RequestClose?.Invoke(null); break;
                case "Create_Bintype": Create_Bintype(); break;
            }
        }
        private async void Create_Bintype()
        {
            if (string.IsNullOrEmpty(inPut_BaseServie16.BinType_Name))
            {
                MessageBox.Show("请填写完整");
            }
            bool res = await baseService.Create_Bintype(InPut_BaseServie16);
            if (res)
            {
                RequestClose?.Invoke(null);
            }
        }
















        public string Title { get; set; } = "新建料盒属性";
        public event Action<IDialogResult> RequestClose;

        public bool CanCloseDialog()
        {
            return true;
        }
        public void OnDialogClosed()
        {
           
        }
        public void OnDialogOpened(IDialogParameters parameters)
        {
           
        }
    }
}
